package mapper;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import po.OrderItems;
import po.Orders;

import java.util.List;

/**
 * Created by Administrator on 2018/1/3.
 */
public interface OrdersAnnotationMapper {
        @Select("select * from orderitems where orders_id = #{id}")
    @Results({
            @Result(id = true ,column = "id",property = "id"),
            @Result(column = "orders_id",property = "orders_id"),
            @Result(column = "items_id",property = "items_id"),
            @Result(column = "items_num",property = "items_num"),
            @Result(column = "user_id" ,property = ""),
            /*one:表示一对一的关系
              many:表示一对多
            select：通过user_id查询用户信息/
             */
            /*@Result( column = "user_id" ,property = "user",
                    one = @One(
                    select = "mapper.UserAnnotationMapper.findById",
                    fetchType = FetchType.LAZY
    )),
            @Result(property = "OrdersItemList",column = "id",
            many= @Many(
                    select = "",
            fetchType = FetchType.LAZY)
    )*/
    })
        List<OrderItems> findByOrdersId(int id);
}
